import { Column, Entity } from "typeorm";
import { BaseEntity } from "../../base/entity/base";

export enum CertificateType {
    DRIVER = 'driver',
    GUIDE_LICENSED = 'guide-licensed',
    GUIDE_UNLICENSED = 'guide-unlicensed',
}

export enum ProviderCertificateStatus {
    SUBMITTED = 0,
    REVIEWING = 1,
    PASSED = 2,
    FAILED = 3,
}

@Entity('provider_certificate', { comment: '服务人员资质认证' })
export class ProviderCertificateEntity extends BaseEntity {
    @Column({ comment: '资质类型', type: 'varchar', length: 50, nullable: false })
    type: CertificateType;

    @Column({ comment: '姓名', length: 50, nullable: true })
    name: string;

    @Column({ comment: '证件号码', length: 50, nullable: false })
    number: string;

    @Column({ comment: '证件照片', type: 'json', nullable: false })
    photos: string[];

    @Column({ comment: '认证数据', type: 'json', nullable: true })
    data: any;

    @Column({ comment: '备注', nullable: true })
    remark: string;

    @Column({ comment: '服务人员ID', nullable: false })
    providerId: number

    @Column({ comment: '状态', type: 'tinyint', default: ProviderCertificateStatus.SUBMITTED })
    status: ProviderCertificateStatus;

    @Column({ comment: '驳回原因', nullable: true })
    rejectReason?: string;

}
